class Solution(object):
    def countMatches(self, items, ruleKey, ruleValue):
        if ruleKey == 'type':
            index = 0
        if ruleKey == 'color':
            index = 1
        if ruleKey == 'name':
            index = 2
        return sum([item[index] == ruleValue for item in items])
